package com.kinyx.framework.db.sentence.res;

import com.kinyx.framework.annotation.assist.Tester;
import com.kinyx.framework.db.configs.DBConfigs;
import com.kinyx.framework.db.sentence.CompareType;

import lombok.AccessLevel;
import lombok.Getter;

/**
 * 比较型表达式子句
 */
@Tester("com.kinyx.framework.db.sentence.res._Expression_COMPARE_Tester_")
class _Expression_COMPARE extends _Expression {

	/** 参数 */
	@Getter(value = AccessLevel.PACKAGE)
	private final Object param;

	_Expression_COMPARE(final Column column, final CompareType compareType, final Object param) {
		super(column, compareType.getValue());
		this.param = param;
	}

	@Override
	public String getSentence(final DBConfigs configs, final boolean isSQL, final boolean withTableAlias) {
		return super.getSentence(configs, isSQL, withTableAlias) + " ?";
	}

	@Override
	public String toString() {
		return super.toString() + String.format(", param: [%s]", String.valueOf(this.param));
	}

}
